<?php
class Zendvn_Controller_Config{
	
	protected $_module;
	protected $_fileConfig;
	protected $_section;
	protected $_configObj;
	
	public function __construct($options = null){
		
		if(!empty($options['module'])){
			$this->_module = $options['module'];
		}
		
		if(!empty($options['fileConfig'])){
			$this->_fileConfig = $options['fileConfig'];
		}
		
		if(!empty($options['section'])){
			$this->_section = $options['section'];
		}else{
			$this->_section = 'default';
		}
		
		$filename = APPLICATION_PATH . '/modules/' 
					. $this->_module . '/configs/' . $this->_fileConfig;
		
		$config = new Zend_Config_Ini($filename,$this->_section);
		
		$this->_config = $config;
	}
	
	public function getConfig($path = null){
		$config = $this->_config->toArray();
		if($path == null){
			$value = $config;
		}else{
			$value = @$config[$path];
		}		
		return $value;
	}
	
}